package com.ruoyi.common.enums;

import java.util.HashMap;
import java.util.Map;

public enum ImageType {
    MAIN("1", "MAIN"),
    ATTACH("2", "ATTACH"),
    OTHER("3", "OTHER");


    public static ImageType toImageType(String value) {
        return codeMap.get(value);
    }

    public static String getNameByCode(String value) {
        ImageType status = codeMap.get(value);
        if (status != null) {
            return status.getName();
        }
        return "未知状态";
    }

    private static Map<String, ImageType> codeMap;
    private static Map<String, ImageType> nameMap;
    static {
        codeMap = new HashMap<String, ImageType>();
        nameMap = new HashMap<String, ImageType>();
        for (ImageType status : ImageType.values()) {
            codeMap.put(status.getValue(), status);
            nameMap.put(status.getName(), status);
        }
    }
    private String value;
    private String name;

    private ImageType(String value, String name) {
        this.value = value;
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public String toString() {
        return this.getValue() + "-" + this.getName();
    }

    public static void main(String[] args) {
        for (ImageType status : ImageType.values()) {
        }
    }
}
